<template>
	<om-formsub-outer :index="index" :checkedit="checkedit" :deleteBtn="false">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData,hasValue} from '@/static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData()
		},
		methods:{
			
		},
		onShow() {
			
		},
		onLoad(e) {
			let _that = this
			subOnLoad(_that, e, function() {
				if(e.configDataCacheKey){
					uni.getStorage({
						key: e.configDataCacheKey,
						success: function(res) {
							if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
								_that.autoformdata = res.data
								_that.formdata.shouldPartakeFlag = _that.formdata.shouldPartakeFlag == true ? '√' : ''
								_that.formdata.truancyFlag = _that.formdata.truancyFlag == true ? '√' : ''
								_that.formdata.lateFlag = _that.formdata.lateFlag == true ? '√' : ''
								Object.assign(_that.initValue, _that.formdata)
								_that.autoformdata[0].order = _that.order
								let arr = [{ value: true, name: '√'}]
								changeEditor('title5', 'leaveFlag', 'data', configSelectData(arr, 'value', 'name'), _that.autoformdata)
								
								if(e.edit){
									if((_that.formdata.signDate && _that.formdata.shouldPartakeFlag == '√') || (_that.formdata.shouldPartakeFlag == '')){
										_that.$nextTick(function(){
											_that.$refs.autoform.changeEditor("title5","leaveFlag","type","labelbox")
										})
									}
									else{
										_that.$nextTick(function(){
											_that.$refs.autoform.initSelectIndex("title5", "leaveFlag")
										})
									}
								}	
							}
						}
					})
				}			
			})
		}
	}
</script>

<style>
</style>                                                                                                                                                                                                                                                                                                                                                                                                                                                         
